package com.ptmall.app.ui.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.TextView;

import com.ptmall.app.R;
import com.ptmall.app.bean.SpreadBean;
import com.ptmall.app.bean.TimeSelectBean;

import java.util.Calendar;
import java.util.List;
import java.util.TimeZone;


/**
 * Created by Administrator on 2018/1/12.
 */

public class ShareAdapter extends BaseAdapter {

    public ShareAdapter() {
    }

    List<SpreadBean.Data> list;

    public void pushData(List<SpreadBean.Data> list){
        this.list = list;
        notifyDataSetChanged();
    }


    @Override
    public int getCount() {
        if(list == null){
            return 0;
        }
        return list.size();
    }

    Click click;

    public void setClick(Click click){
        this.click = click;
    }


    @Override
    public Object getItem(int position) {
        return 0;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (null == convertView) {
            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_share, parent,false);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.name.setText(list.get(position).tel);
        viewHolder.time.setText(list.get(position).create_time);

        return convertView;
    }

    class ViewHolder {
        TextView name,time;

        ViewHolder(View view) {
            name = (TextView) view.findViewById(R.id.name);
            time = (TextView) view.findViewById(R.id.time);
        }
    }

    public  interface Click{
        void Click(boolean position, int i);
        void Click2(boolean position, int i);
    }


}
